package com.ruoyi.team.service.impl;

import java.util.List;

import com.ruoyi.team.domain.GoodsCategory;
import com.ruoyi.team.service.IGoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.team.mapper.GoodsMapper;
import com.ruoyi.team.domain.Goods;
import com.ruoyi.team.service.IGoodsService;

/**
 * 物品信息Service业务层处理
 *
 * @author 小马
 * @date 2022-11-27
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {
    @Autowired
    private IGoodsCategoryService categoryService;

    /**
     * 查询物品信息列表
     *
     * @param goods 物品信息
     * @return 物品信息
     */
    @Override
    public List<Goods> selectGoodsList(Goods goods) {
       if (goods.getCategoryId()!=null){
           String categoryId = goods.getCategoryId();
           GoodsCategory category = categoryService.getById(Long.parseLong(categoryId));
           goods.getParams().put("busiPath", category.getBusiPath());
       }
        return getBaseMapper().selectGoodsList(goods);
    }
}
